import type { PatientItem } from '@/types/patient'
import request from '@/utils/request'

export interface AddPatientParams {
  name: string
  idCard: string
  gender: number
  defaultFlag: number
}

/**
 * 获取患者（家庭档案）列表
 */
export const getPatientListApi = () => {
  return request.get<null, PatientItem[]>('/patient/mylist')
}

/**
 * 添加患者
 */
export const addPatient = (data: AddPatientParams) => {
  return request.post<AddPatientParams, PatientItem>('/patient/add', data)
}

/**
 * 删除患者（家庭档案）
 */
export const removePatientApi = (id: string) => {
  return request.delete(`/patient/del/${id}`)
}

/**
 * 患者详情（家庭档案）
 */
export const patientDetailApi = (id: string) => {
  return request.get<null, PatientItem>(`/patient/info/${id}`)
}

/**
 * 编辑（更新）患者（家庭档案）
 */
export const updatePatientApi = (data: PatientItem) => {
  return request.put(`/patient/update`, data)
}


